1. Field of the Invention
The present invention relates to an image processing apparatus and a method for image processing used to compress and encode image data.
2. Description of the Related Art
In image forming devices such as a printing device, printing operation is performed by temporarily storing received image data into a memory, and reading out the image data stored in the memory at a predetermined timing. In this case, a large capacity of memory is required to store the image data into the memory without change, thereby increasing the costs of apparatus. Accordingly, in general, received image data is stored in a memory by compressing and encoding the image data. To compress and encode image data, a prediction encoding method is generally used. The prediction encoding method predicts a pixel value of an attention pixel from a pixel value of pixels surrounding the attention pixel, by using characteristics in which adjacent pixels in an image have high correlation.
Japanese Patent No. 2888186 discloses an image encoding apparatus including a plurality of predicting units and prediction error calculating units, a selecting unit that selects the plurality of predicting units and prediction error calculating units, and an encoding unit that encodes identification numbers of the prediction error calculating units and predicting units. In Japanese Patent No. 2888186, the length correctly predicted by the predicting units is encoded by run-length, and if the prediction is not correct, the prediction error calculated by the prediction error calculating unit is encoded.
With reference to FIG. 30, a general data flow in a printing device when image data is compressed and encoded is schematically described. In an example in FIG. 30, a printing device includes an electrical control device 500 and a printer engine 504. The electrical control device 500 includes a controlling unit 501, an image processing unit 502, and a main memory 503. In the electrical control device 500, the controlling unit 501 and the image processing unit 502 are connected with a bus 505.
The controlling unit 501 generates drawing data based on page description language (PDL) data supplied from, for example, a computer (PC) 550 through a network 551 and a communication controller 516, and controls the generated drawing data exchanged between the main memory 503 and the image processing unit 502. The image processing unit 502 stores the drawing data into the main memory 503 by compressing and encoding the drawing data. The image processing unit 502 also decodes the compressed and encoded drawing data and sends to the printer engine 504.
In such a structure, for example, drawing is performed by a central processing unit (CPU) 510 based on PDL data supplied, to the controlling unit 501 from the PC 550, thereby generating multi-valued band data of cyan, magenta, yellow, and black (CMYK) plates. The multi-valued band data is stored in a multi-valued CMYK band data storage area 520 of the main memory 503 through a memory arbiter (ARB) 512 (passage A). A CPU interface (I/F) 511 and a memory controller 514 control data transmission between the memory arbiter 512 and the CPU 510, and between the memory arbiter 512 and the main memory 503. A Direct Memory Access Controller (DMAC) 513 controls an access to the main memory 503.
For example, C-plate band data stored in the CMYK band data storage area 520 of the main memory 503 is read out from the main memory 503 by a DMA controller, which is not shown, in the image processing unit 502, and is supplied to an encoding unit 532 through the bus 505 (passage B). Data transmission on the bus 505 is controlled by a bus controller 515 and a bus I/F 531.
The encoding unit 532 compresses and encodes the supplied C-plate band data by using prediction encoding and the like. C-plate band code data obtained by compressing and encoding the C-plate band data is sequentially stored in a multi-valued CMYK page code storage area 521 in the main memory 503 through the bus 505. The encoding unit 532 sequentially performs encoding of band data for each band data of CMYK plates.
If data for one page is stored therein, C-plate band code data as much as one page is sequentially read out from the multi-valued CMYK page code storage area 521, and supplied to a decoding unit 533 in the image processing unit 502 through the bus 505 as C-plate page code data (passage C). The decoding unit 533 decodes a compression code of the supplied C-plate page code data, and outputs as C-plate page data. Predetermined image processing is applied to the C-plate page data by an image processing unit 534, and is supplied to the printer engine 504 through an engine controller 535. The printer engine 504 performs printing at a predetermined speed, based on the supplied C-plate page data.
The reading out of the band code data from the multi-valued CMYK page code storage area 521, decoding by the decoding unit 533, and printing performed by the printer engine 504 are sequentially performed on each page of CMYK plates, in synchronization with the printer engine 504.
Japanese Patent Application Laid-open No. H8-174919 discloses a technology in which high-resolution printing is performed on text data and computer graphics (CG) data, and high-gradation printing is performed on image data such as a natural image like a photograph or a picture. According to Japanese Patent Application Laid-open No. H8-174919, an amount of data to be processed is reduced by switching processes based on the type of data, thereby reducing costs by improving printing speed and saving memory.
In other words, in Japanese Patent Application Laid-open No. H8-174919, image data of a natural image, for example, is produced by a multi-value of a low-resolution of 300 dots per inch (dpi) and a bit depth of 8 bits, encoded by the multi-value, and stored in the memory. Text data and CG data, for example, are produced by a small value of a high-resolution of 600 dpi and a bit depth from 2 to 4 bits, encoded by the small value, and stored in the memory. The amount of data is reduced and printing speed is improved, by reading the code encoded by the multi-value and the code encoded by the small value from the memory during printing, combining the codes, and printing them.
Japanese Patent Application Laid-open No. 2001-157062 discloses a technology in which printing process is completed in a predetermined printing time, by compressing image data to be printed, transferring and decompressing the data through a common bus, and performing printing. Japanese Patent Application Laid-open No. 2001-157062 prevents the transfer speed of the common bus in a controller from being the bottleneck of processing speed.
Japanese Patent Application Laid-open No. 2001-245159 discloses a technology in which, when compressed image data is generated by compressing image data received from a scanner and is output to the bus, a resolution of input image data can be adaptively switched corresponding to the production speed of compressed image data. In Japanese Patent Application Laid-open No. 2001-245159, whether production speed of compressed image data exceeds the output speed of the compressed image data to the bus is determined. If the production speed exceeds the output speed, a resolution of the input image data is reduced. Compression processing and output to the bus are repeated relative to the input image data having the low resolution.
In a printing device and the like, as illustrated in the passage C in FIG. 30, printing is performed by reading page code data of CMYK plates obtained by compressing and encoding drawing data from the main memory 503 through the bus 505, and decoding the data by the decoding unit 533, by synchronizing with the printer engine 504. At this time, if the compression ratio of the page code data is worse than expected, the transmission rate of the page code data synchronized with the printer engine 504 may exceed the transfer rate of the bus 505, thereby preventing the page code data from being printed normally.
In particular, because the correlation between pixels is small in image data of a natural image, prediction obtained by prediction encoding may not be correct. Particularly, if image data of a natural image, and text data and CG data are mixed on one page, compression ratio may be worse than expected.
In Japanese Patent Application Laid-open No. H8-174919, when text data and CG data, and image data of a natural image are combined on one page to be printed, logic operation between the text data and CG data produced by a small value and the image data produced by a multi-value is difficult.
In Japanese Patent Application Laid-open No. 2001-157062, a Joint Bi-level Image Coding Expert Group (JBIG) is used as a compression encoding method of drawing data. The JBIG allows progressive transmission of image by forming an image pyramid and sequentially transmitting an image from an image with a rough resolution. If a compression ratio for realizing a target transmission rate cannot be obtained, only a low resolution layer is converted into compression data. However, in this case, resolution of the whole printer image to be printed is lowered, thereby reducing the image quality of an image portion of text data and CG data with which high resolution is particularly demanded. The same problem also applies to Japanese Patent Application Laid-open No. 2001-245159.